package com.acwing.partition37;

import java.io.*;

/**
 * @author rkc
 * @date 2022/7/22 9:04
 */
public class AC3644水仙花数 {

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        while (true) {
            int l = nextInt(), r = nextInt();
            if (l == 0 && r == 0) break;
            boolean flag = false;
            for (int i = l; i <= r; i++) {
                if (check(i)) {
                    flag = true;
                    writer.print(i + " ");
                }
            }
            if (!flag) writer.print("no");
            writer.println();
        }
        writer.flush();
    }

    private static boolean check(int x) {
        int res = 0, y = x;
        while (x != 0) {
            int t = x % 10;
            x /= 10;
            res += t * t * t;
        }
        return res == y;
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
